import { Model } from './model.js';
var model = new Model();
Page({
  /**
   * 页面的初始数据
   */
  data: {
    current: 1,
    current_scroll: 1,
    item_current: 0,
    interval: 2000,
    duration: 500,
    order_list: ''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },
  onShow: function () {
    this.getUserOrder();
  },
  // head_tab 切换
  handleChange: function (e) {
    var head_tab_curr = parseInt(e.detail.key) - 1;
    this.setData({ item_current: head_tab_curr })
  },

  // 切换tab
  switchTab: function (e) {
    var tab_curr = e.detail.current;
    this.setData({ current: tab_curr + 1 });
  },

  // 获取订单列表
  getUserOrder() {
    model.getUserMessage((res) => {
      this.list = res.data
      this.setData({ list: res.data })
    })
  }
})